package org.soenea.doitall.domain.model.person;

import org.dsrg.soenea.domain.DomainObjectCreationException;
import org.dsrg.soenea.domain.MapperException;
import org.dsrg.soenea.domain.proxy.DomainObjectProxy;
import org.soenea.doitall.domain.model.person.mapper.PersonInputMapper;

public class PersonProxy extends DomainObjectProxy<Long, Person> implements
		IPerson {

	public PersonProxy(Long id) {
		super(id);
	}

	@Override
	public String toString() {
		return getInnerObject().toString();
	}

	@Override
	public String getUserName() {
		// TODO Auto-generated method stub
		return getInnerObject().getUserName();
	}

	@Override
	public void setUserName(String userName) {
		// TODO Auto-generated method stub
		getInnerObject().setUserName(userName);
	}

	@Override
	public int getGroupNum() {
		// TODO Auto-generated method stub
		return getInnerObject().getGroupNum();
	}

	@Override
	public void setGroupNum(int groupNum) {
		// TODO Auto-generated method stub
		getInnerObject().setGroupNum(groupNum);
	}

	@Override
	public String getFirstName() {
		// TODO Auto-generated method stub
		return getInnerObject().getFirstName();
	}

	@Override
	public void setFirstName(String firstName) {
		// TODO Auto-generated method stub
		getInnerObject().setFirstName(firstName);
	}

	@Override
	public String getLastName() {
		// TODO Auto-generated method stub
		return getInnerObject().getLastName();
	}

	@Override
	public void setLastName(String lastName) {
		// TODO Auto-generated method stub
		getInnerObject().setLastName(lastName);
	}

	@Override
	public String getPassword() {
		// TODO Auto-generated method stub
		return getInnerObject().getPassword();
	}

	@Override
	protected Person getFromMapper(Long id) throws MapperException,
			DomainObjectCreationException {
		// TODO Auto-generated method stub
		try{
			return PersonInputMapper.find(id);
		}catch (Exception e) {
			throw new DomainObjectCreationException(e.getMessage(),e);
		}
	}

}
